package com.example.demo.module.springinitial;

import com.example.demo.Controler.DemoController;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Service;

import javax.annotation.PreDestroy;
import javax.annotation.Resource;

/**
 * @author lufei
 * @version 1.0
 * @created 18-6-12
 */
@Service
public class Base1 extends Base implements DisposableBean, InitializingBean {

    @Resource
    private AService aService;

    public Base1(DemoController demoController) {
        super(15);

    }

   /* @PostConstruct
    public void init() {
        aService.talk();
    }*/

    @PreDestroy
    public void release() {
        System.out.println("release:name:" + name + "age:" + age);
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("name:" + name + "age:" + age);
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        aService.talk();
    }
}
